package org.example.feignclients;

import org.example.domain.User;
import org.example.fallback.UserFeignClientFallback;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * 订单服务
 * @EnableFeignClients 表示开启Fiegn支持
 */
@FeignClient(value = "user-server",fallback = UserFeignClientFallback.class)
public interface UserFeignClient {


    //要调用服务的Controller中的方法
    //1.url要一样 ， 2.参数要一样 ， 3.返回值要一样
    @GetMapping(value = "/user/{id}")
    User getUserById(@PathVariable("id") Long id);
}
